{extend name='common@layout/buy' /}
{block name='content'}
<div class="ncc-wrapper">
<style>
.ncc-table-style tbody tr.item_disabled td {
	background: none repeat scroll 0 0 #F9F9F9;
	height: 30px;
	padding: 10px 0;
	text-align: center;
}
</style>
<div class="ncc-main">
  <div class="ncc-title">
    <h3>我的购物车</h3>
    <h5>查看购物车商品清单，增加减少商品数量，并勾选想要的商品进入下一步操作。</h5>
  </div>
  <form action="{:url('member/buy/step2')}" method="POST" id="form_buy" name="form_buy">
    <input type="hidden" value="1" name="ifcart">
    <div class="new_p16 border2">
    <table class="ncc-table-style" nc_type="table_cart">
      <thead>
        <tr>
          <th class="w50"><label>
              <input type="checkbox" checked value="1" id="selectAll">
              全选</label></th>
          <th></th>
          <th>商品</th>
          <th class="w120">单价（元）</th>
          <th class="w120">数量</th>
          <th class="w120">小计（元）</th>
          <th class="w80">操作</th>
        </tr>
      </thead>
      <?php foreach($store_cart_list as $store_id => $cart_list) {?>
      <tbody>
        <tr>
          <th colspan="20"><strong><a href="<?php echo url('index/store/index',array('store_id'=>$store_id));?>"><?php echo $cart_list[0]['store_name']; ?></a></strong> <span member_id="<?php echo $store_list[$store_id]['member_id'];?>"></span>
            <?php if (!empty($free_freight_list[$store_id])) {?>
            <div class="store-sale"><em><i class="icon-gift"></i>免运费</em><?php echo $free_freight_list[$store_id];?>&emsp;</div>
            <?php } ?>
          </th>
        </tr>

        <?php foreach($cart_list as $cart_info) {?>
        <tr id="cart_item_<?php echo $cart_info['cart_id'];?>" nc_group="<?php echo $cart_info['cart_id'];?>" class="shop-list <?php echo $cart_info['state'] ? '' : 'item_disabled';?>">
          <td class="border2-left"><input type="checkbox" <?php echo $cart_info['state'] ? 'checked' : 'disabled';?> nc_type="eachGoodsCheckBox" value="<?php echo $cart_info['cart_id'].'|'.$cart_info['goods_num'];?>" id="cart_id<?php echo $cart_info['cart_id'];?>" name="cart_id[]"></td>
          <?php if ($cart_info['bl_id'] == '0') {?>
          <td class="w60"><a href="<?php echo url('index/goods/detail',array('goods_id'=>$cart_info['goods_id']));?>" target="_blank" class="ncc-goods-thumb"><img src="<?php echo img_url($cart_info['goods_image'],60);?>" alt="<?php echo $cart_info['goods_name']; ?>" /></a></td>
          <?php } ?>
          <td class="tl" <?php if ($cart_info['bl_id'] != '0') {?>colspan="2"<?php }?>><dl class="ncc-goods-info">
              <dt><a href="<?php echo url('index/goods/detail',array('goods_id'=>$cart_info['goods_id']));?>" target="_blank"><?php echo $cart_info['goods_name']; ?></a></dt>
              <?php if (!empty($cart_info['xianshi_info'])) {?>
              <dd> <span class="xianshi">满<strong><?php echo $cart_info['xianshi_info']['lower_limit'];?></strong>件，单价直降<em>￥<?php echo $cart_info['xianshi_info']['down_price']; ?></em></span> </dd>
              <?php }?>
              <?php if ($cart_info['ifgroupbuy']) {?>
              <dd> <span class="groupbuy">抢购<?php if ($cart_info['upper_limit']) {?>，最多限购<strong><?php echo $cart_info['upper_limit']; ?></strong>件<?php } ?></span></dd>
              <?php }?>
              <?php if ($cart_info['bl_id'] != '0') {?>
              <dd><span class="buldling">优惠套装，单套直降<em>￥<?php echo $cart_info['down_price']; ?></em></span></dd>
              <?php }?>

              <?php if (!empty($cart_info['gift_list'])) {?>
              <dd><span class="ncc-goods-gift">赠</span>
                <ul class="ncc-goods-gift-list">
                  <?php foreach ($cart_info['gift_list'] as $goods_info) { ?>
                  <li nc_group="<?php echo $cart_info['cart_id'];?>"><a href="<?php echo url('index/goods/detail', array('goods_id'=>$goods_info['gift_goodsid']));?>" target="_blank" class="thumb" title="赠品：<?php echo $goods_info['gift_goodsname']; ?> * <?php echo $goods_info['gift_amount'] * $cart_info['goods_num']; ?>"><img src="<?php echo img_url($goods_info['gift_goodsimage'],60);?>" alt="<?php echo $goods_info['gift_goodsname']; ?>" /></a>
                    <?php } ?>
                  </li>
                </ul>
              </dd>
              <?php  } ?>
            </dl></td>
          <td class="w120"><em id="item<?php echo $cart_info['cart_id']; ?>_price"><?php echo $cart_info['goods_price']; ?></em></td>
          <?php if ($cart_info['state']) {?>
          <td class="w120 ws0"><a href="JavaScript:void(0);" onclick="decrease_quantity(<?php echo $cart_info['cart_id']; ?>);" title="减少商品件数" class="add-substract-key tip">-</a>
              <input id="input_item_<?php echo $cart_info['cart_id']; ?>" value="<?php echo $cart_info['goods_num']; ?>" orig="<?php echo $cart_info['goods_num']; ?>" changed="<?php echo $cart_info['goods_num']; ?>" onkeyup="change_quantity(<?php echo $cart_info['cart_id']; ?>, this);" type="text" class="text w20" style="text-align: center;"/>
            <a href="JavaScript:void(0);" onclick="add_quantity(<?php echo $cart_info['cart_id']; ?>);" title="增加商品件数" class="add-substract-key tip" >+</a></td>
          <?php } else {?>
          <td class="w120">无效
            <input type="hidden" value="<?php echo $cart_info['cart_id']; ?>" name="invalid_cart[]"></td>
          <?php }?>
          <td class="w120"><?php if ($cart_info['state']) {?>
            <em id="item<?php echo $cart_info['cart_id']; ?>_subtotal" nc_type="eachGoodsTotal"><?php echo $cart_info['goods_total']; ?></em>
            <?php }?></td>
          <td class="w80 border2-right"><?php if ($cart_info['bl_id'] == '0') {?>
           <?php } ?>
            <a href="javascript:void(0)" onclick="drop_cart_item(<?php echo $cart_info['cart_id']; ?>);">删除</a></td>
        </tr>

        <?php if (is_array($cart_info['bl_goods_list'])) {?>
        <?php foreach ($cart_info['bl_goods_list'] as $goods_info) { ?>
        <tr class="shop-list <?php echo $cart_info['state'] ? '' : 'item_disabled';?>" nc_group="<?php echo $cart_info['cart_id'];?>">
          <td></td>
          <td class="w60"><a href="<?php echo url('index/goods/detail',array('goods_id'=>$goods_info['goods_id']));?>" target="_blank" class="ncc-goods-thumb"><img src="<?php echo img_url($goods_info['goods_image'],60);?>" alt="<?php echo $goods_info['goods_name']; ?>" /></a></td>
          <td class="tl"><dl class="ncc-goods-info">
              <dt><a href="<?php echo url('index/goods/detail',array('goods_id'=>$goods_info['goods_id']));?>" target="_blank"><?php echo $goods_info['goods_name']; ?></a> </dt>
            </dl></td>
          <td><em><?php echo $goods_info['bl_goods_price'];?></em></td>
          <td><?php echo $cart_info['state'] ? '' : '无效';?></td>
          <td></td>
          <td><!--to do 收藏<a href="javascript:void(0)" onclick="collect_goods('<?php echo $goods_info['goods_id']; ?>');">收藏</a>--><br/></td>
        </tr>
        <?php } ?>
        <?php  } ?>

        <?php } ?>
        <?php if (!empty($mansong_rule_list[$store_id]) && is_array($mansong_rule_list[$store_id])) {?>
        <tr nc_group="<?php echo $cart_info['cart_id'];?>">
          <td></td>
          <td class="tl" colspan="10"><div class="store-sale"><em> <i class="icon-gift"></i> 满即送 </em><?php echo implode('<br/>', $mansong_rule_list[$store_id]);?></div></td>
        </tr>
        <?php }?>

        <tr class="border2">
          <td class="tr" colspan="20"><div class="ncc-store-account">
              <dl>
                <dt>店铺合计：</dt>
                <dd><em nc_type="eachStoreTotal"></em>元</dd>
              </dl>
            </div></td>
        </tr>
        <?php }?>
      </tbody>
      <tfoot>
        <tr>
          <td colspan="20">
          	
          	<div class="ncc-all-account new_border2 new_mt20 new_pr25">
          		<div class="pull-left new_w260 text_left new_pl10 f14">
              	<a class="new_ml10" onclick="drop_cart_all_item()" style="cursor: pointer;"><span class="f14 c_gray">删除选中的商品</span></a>
          		</div>
          		商品总价（不含运费）
          			<em id="cartTotal" class="fb"><?php echo $cart_totals; ?></em>
          			<em class="fb">元</em>
          	</div>
          </td>
        </tr>
      </tfoot>
    </table>
    </div>
  </form>
  <div class="ncc-bottom"><a id="next_submit" href="javascript:void(0)" class="btn_pink fr"><i class="icon-pencil"></i>下一步，填写核对购物信息</a></div>
	
	<div class="new_w100_ new_h100"></div>
  <div id="guesslike_div"></div>
</div>
</div>
{/block}